package com.xiaoxing.paimai.app;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.DisplayMetrics;

import com.jess.arms.base.BaseApplication;
import com.mob.MobSDK;

import java.util.Locale;

import me.jessyan.armscomponent.commonsdk.utils.LanguageUtil;

/**
 * @author 小星 QQ:753940262
 * @class describe
 * @time 2018/7/19 0019 8:46
 */
public class MyApplication extends BaseApplication {

    private static Context mContext;

    @Override
    public void onCreate() {
        super.onCreate();
        mContext = getApplicationContext();
        MobSDK.init(this);
//        initI18();
    }

    public static Context getContext() {

        return mContext;
    }

    /**
     * 初始化国际化语言，繁体字和简体字
     */
    private void initI18() {
        Resources resources = getResources();

        DisplayMetrics dm = resources.getDisplayMetrics();
        Configuration config = resources.getConfiguration();
        if (LanguageUtil.getCountry(getApplicationContext()).equals("TW")) {

            config.locale = Locale.TAIWAN;

        } else {

            config.locale = Locale.TAIWAN;
        }

        resources.updateConfiguration(config, dm);
    }

}
